package com.icss.lesson3;

import java.io.*;

public class TestMain6 {
    public static void main(String[] args) {

        // InputStreamReader :  字节字符流
        //
        try (
            Reader r = new InputStreamReader(new FileInputStream("D:/a.txt"), "UTF-8");
        ){
            // 缓存区是 char数组
            char[] buffer = new char[10];
            int len = -1;
            while ((len = r.read(buffer)) != -1) {
                System.out.println(new String(buffer, 0, len));

            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
